package com.leoman.welfare.dao;

import com.leoman.common.dao.IBaseJpaRepository;
import com.leoman.welfare.entity.UserWelfareCount;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by Administrator on 2016/6/12.
 */
public interface UserWelfareCountDao extends IBaseJpaRepository<UserWelfareCount> {

    @Query("select a from UserWelfareCount a where a.userInfo.id = ?1")
    public List<UserWelfareCount> findListByUserId(Long userId);

    @Query("select a from UserWelfareCount a where a.welfare.id = ?1")
    public List<UserWelfareCount> findListByWelfareId(Long welfareId);

    @Query("select a from UserWelfareCount a where a.userInfo.id = ?1 and a.welfare.id = ?2")
    public UserWelfareCount findOneByUserIdAndWelfareId(Long userId, Long welfareId);
}